const AppDevice = require('./APPDevice');
const appDevice = new AppDevice ();
const process = require ('process');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
var tslSocket = appDevice.connectToServer ();
tslSocket.on ('secureConnect', function () {
  console.log('appconnect')
  this.write ('{"deviceId":1}');
  setTimeout (function () {
    tslSocket.write ('啦啦啦啦');
  }, 3000);
});
tslSocket.on ('data', function (data) {
  console.log (data.toString ());
});
tslSocket.on('close',function(){
    console.log('byebye')
})